﻿<Window 
  x:Class="SkinnableApp.MainWindow"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
  xmlns:scm="clr-namespace:System.ComponentModel;assembly=WindowsBase"
  xmlns:local="clr-namespace:SkinnableApp"
  SizeToContent="Height"
  ResizeMode="NoResize"
  Title="Skinnable App"
  Width="680"
  WindowStartupLocation="CenterScreen"
  WindowStyle="ToolWindow"
  >
  <Grid Style="{DynamicResource styleBackground}">
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="*" />
      <ColumnDefinition Width="2.5*" />
    </Grid.ColumnDefinitions>    

    <!-- CONTEXT MENU -->
    <Grid.ContextMenu>
      <ContextMenu MenuItem.Click="OnMenuItemClick">
        <MenuItem Tag=".\Resources\Skins\BlackSkin.xaml" IsChecked="True">
          <MenuItem.Header>
            <Rectangle Width="120" Height="40" Fill="Black" />
          </MenuItem.Header>
        </MenuItem>
        <MenuItem Tag=".\Resources\Skins\GreenSkin.xaml">
          <MenuItem.Header>
            <Rectangle Width="120" Height="40" Fill="Green" />
          </MenuItem.Header>
        </MenuItem>
        <MenuItem Tag=".\Resources\Skins\BlueSkin.xaml">
          <MenuItem.Header>
            <Rectangle Width="120" Height="40" Fill="Blue" />
          </MenuItem.Header>
        </MenuItem>
      </ContextMenu>
    </Grid.ContextMenu>

    <!-- AGENTS DATA SOURCE -->
    <Grid.DataContext>
      <CollectionViewSource>
        <CollectionViewSource.Source>
          <XmlDataProvider Source=".\Resources\Data\agents.xml" XPath="Agents/Agent" />
        </CollectionViewSource.Source>
        <CollectionViewSource.SortDescriptions>
          <scm:SortDescription PropertyName="Name/Last" />
          <scm:SortDescription PropertyName="Name/First" />
        </CollectionViewSource.SortDescriptions>
      </CollectionViewSource>
    </Grid.DataContext>

    <!-- BANNER -->
    <Grid Grid.ColumnSpan="2" Height="70" Style="{DynamicResource styleBanner}" >
      <TextBlock 
        FontSize="26" 
        Padding="10,0,10,0" 
        Text="Insurance Agent Management System" 
        VerticalAlignment="Center" 
        />
    </Grid>

    <!-- AGENT SELECTOR -->
    <local:AgentSelectorControl     
      Grid.Row="1" Grid.Column="0"       
      />

    <!-- AGENT DETAILS -->
    <local:AgentDetailsControl 
      Grid.Row="1" Grid.Column="1"       
      />
  </Grid>
</Window>